package Collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SoetPoint {
    public static void main(String[] args) {
        List<Point> list=new ArrayList<>();
        list.add(new Point(1,2));
        list.add(new Point(2,3));
        list.add(new Point(4,5));
        list.add(new Point(6,7));
        list.add(new Point(8,9));
        list.add(new Point(0,1));
        list.add(new Point(1,2));
        list.add(new Point(3,4));
        System.out.println("list原数据:"+list);
        Collections.sort(list, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o1.getX()-o2.getX();
            }
        });
        System.out.println("list排序后的数据"+list);

    }
}
